Class NewsSourcesServiceTest

java.lang.Object
com.fsf.news.service.NewsSourcesServiceTest

@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class) class NewsSourcesServiceTest extends Object
Unit tests for the NewsSourcesService class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) com.fsf.news.client.NewsApiClient
     
    (package private) com.fsf.news.processor.NewsFleschMetricsProcessor
     
    (package private) com.fsf.news.model.form.NewsSourcesForm
     
    (package private) play.twirl.api.Html
     
    (package private) com.fasterxml.jackson.databind.JsonNode
     
    (package private) com.fsf.news.renderer.NewsRenderer
     
    (package private) com.fsf.news.processor.NewsResponseProcessor
     
    (package private) com.fsf.news.repository.NewsSourcesRepository
     
    (package private) com.fsf.news.service.NewsSourcesService
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Tests that the addSourcesResult method adds a sources result and returns the expected result.
    (package private) void
    Tests that the addSourcesResult method does not add a sources result that has no sources.
    (package private) void
    Tests that the addSourcesResult method throws an exception when no session ID is provided.
    (package private) void
    Tests that the getSourceProfile method returns the expected result.
    (package private) void
    Tests that the getSourcesResults method returns the expected results.
    (package private) void
    Tests that the getSourcesResults method throws an exception when no session ID is provided.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sourcesService

      @InjectMocks com.fsf.news.service.NewsSourcesService sourcesService
    • apiClient

      @Mock com.fsf.news.client.NewsApiClient apiClient
    • responseProcessor

      @Mock com.fsf.news.processor.NewsResponseProcessor responseProcessor
    • fleschMetricsProcessor

      @Mock com.fsf.news.processor.NewsFleschMetricsProcessor fleschMetricsProcessor
    • renderer

      @Mock com.fsf.news.renderer.NewsRenderer renderer
    • sourcesRepository

      @Mock com.fsf.news.repository.NewsSourcesRepository sourcesRepository
    • form

      @Mock com.fsf.news.model.form.NewsSourcesForm form
    • jsonNode

      @Mock com.fasterxml.jackson.databind.JsonNode jsonNode
    • html

      @Mock play.twirl.api.Html html
  • Constructor Details

    • NewsSourcesServiceTest

      NewsSourcesServiceTest()
  • Method Details

    • testGetSourcesResults

      @Test void testGetSourcesResults()
      Tests that the getSourcesResults method returns the expected results.
    • testGetSourcesResultsException

      @Test void testGetSourcesResultsException()
      Tests that the getSourcesResults method throws an exception when no session ID is provided.
    • testAddSourcesResult

      @Test void testAddSourcesResult()
      Tests that the addSourcesResult method adds a sources result and returns the expected result.
    • testAddSourcesResultEmpty

      @Test void testAddSourcesResultEmpty()
      Tests that the addSourcesResult method does not add a sources result that has no sources.
    • testAddSourcesResultException

      @Test void testAddSourcesResultException()
      Tests that the addSourcesResult method throws an exception when no session ID is provided.
    • testGetSourceProfile

      @Test void testGetSourceProfile()
      Tests that the getSourceProfile method returns the expected result.